<?php TPL::output('admin/global/header.tpl.htm'); ?>

<!--left-->
<?php TPL::output('admin/global/left.tpl.htm'); ?>
<!--left-->

<!-- main -->
<div id="main-content">
		<div class="clear"></div>
		<div class="content-box">
			<div class="content-box-header">
				<h3><?php echo $this->crumb['last']['name']; ?></h3>
				<ul class="content-box-tabs">
					<li><a href="#tab1" class="default-tab current">标签列表</a></li>
					<li><a href="#tab2" class="">搜索</a></li>
				</ul>
				<div class="clear"></div>
			</div>
			<div class="content-box-content" style="width:800px;">
				<div class="tab-content default-tab" id="tab1">
					<?php if($_GET['action'] == 'search'){ ?>
						<div style="margin:6px;">共有 <?php echo intval($this->topic_num); ?> 条符合条件的内容。</div>
					<?php } ?>
					
					<?php if($this->list){ ?>
					<form id="batchs_form" action="admin/topic/topic_batch/" method="post" style="margin-top:8px;">
					<input type="hidden" name='action_type' value="">
										
					<table class="list">
						<thead>
							<tr>
								<th style="width:40px;" align="center"><input type="checkbox" class="check-all"></th>
								<th>标签标题</th>
								<th style="width:50px; text-align:center;">相关标签</th>
								<th style="width:60px; text-align:center;"><a href="<?php echo $this->search_url; ?>__sort_key-discuss_count__order-<?php if($_GET['sort_key'] == 'discuss_count' && $_GET['order'] == 'DESC'){ ?>ASC<?php }else{ ?>DESC<?php } ?>">站点数<?php if($_GET['sort_key'] == 'discuss_count'){ ?><?php if($_GET['order'] == 'ASC'){ ?><em class="listup">︿</em><?php }else{ ?><em class="listdown">﹀</em><?php } ?><?php } ?></a></th>
								<th style="width:50px; text-align:center;">状态</th>
								<th style="width:100px; text-align:center;">操作</th>
							</tr>
						</thead>
						<tfoot>
							<tr>
								<td colspan="7">
									<div class="bulk-actions align-left">
										<a class="button" onClick="$('#batchs_form > input[name=action_type]').val('remove');ajax_post($('#batchs_form'), _ajax_post_alert_processer); return false;" href="javascript:;">删除选择</a>&nbsp;
										<a class="button" onClick="$('#batchs_form > input[name=action_type]').val('lock');ajax_post($('#batchs_form'), _ajax_post_alert_processer); return false;" href="javascript:;">锁定选择</a>
									</div>
									<div class="pagination">
										<?php echo $this->pagination; ?>
									</div>
									<div class="clear"></div>
								</td>
							</tr>
						</tfoot>
						<tbody style="border-bottom: 1px solid #ddd;">
<?php foreach ($this->list AS $key => $val) { ?>
							<tr>
								<td align="center"><input type="checkbox" name="topic_ids[]" value="<?php echo $val['topic_id']; ?>"></td>
								<td><a href="topic/<?php echo $val['url_token']; ?>" target="_blank"><?php echo $val['topic_title']; ?></a></td>
								<td style="width:50px; text-align:center;">
										<?php if($val['related_topics']){ ?><?php foreach($val['related_topics'] as $topic){ ?><a href="topic/<?php echo $topic['url_token']?>" target="_blank"><?php echo $topic['topic_title']; ?></a>&nbsp;<?php } ?><?php } ?>
								</td>
								<td style="text-align:center;">
									<a href="admin/question/question_list/action-search__topic-<?php echo rawurlencode($val['topic_title']); ?>"><?php echo $val['discuss_count']; ?></a>
								</td>
								<td style="text-align:center;">
								<?php if($val['topic_lock'] == 1){ ?>
									<a href="javascript:;" onClick="topic_lock(<?php echo $val['topic_id']; ?>, 0)" title="解除锁定"><img src="<?php echo G_STATIC_URL;?>/admin/images/icons/lock.png"/></a>
								<?php }else{ ?>
									<a href="javascript:;" onClick="topic_lock(<?php echo $val['topic_id']; ?>, 1)" title="锁定标签"><img src="<?php echo G_STATIC_URL;?>/admin/images/icons/unlock.png"/></a>
								<?php } ?>
								</td>
								<td style="width:100px; text-align:center;">
									<a href="admin/topic/edit/topic_id-<?php echo $val['topic_id']; ?>" title="修改标签"><img src="<?php echo G_STATIC_URL;?>/admin/images/icons/pencil.png"/></a>
								</td>
							</tr>
<?php } ?>
						</tbody>
					</table>
					</form>
					<?php } ?>
				</div>
				
				<div class="tab-content" id="tab2" style="display:none;">
				<form method="post" action="admin/topic/list/" onsubmit="return false;" id="search_form">
				<input name="action" type="hidden" value="search"/>
				<p>
					<label> 关键词：</label>
					<input type="text" value="<?php echo rawurldecode($_GET['keyword']); ?>" name="keyword" class="text-input small-input">
				</p>
				<p>
					<label> 包含站点数：</label>
					<input type="text" name="question_count_min" value="<?php echo $_GET['question_count_min']; ?>" class="text-input" style="width:40px;"> - <input type="text" name="question_count_max" value="<?php echo $_GET['question_count_max']; ?>" class="text-input" style="width:40px;">
				</p>
				<p>
					<label> 是否有图片：</label>
					<label style="float:left;"><input type="radio" value="1" name="topic_pic"<?php if($_GET['topic_pic'] == '1'){ ?> checked="true"<?php } ?>> 有</label>
					<label style="margin-left:10px; float:left;"><input type="radio" value="2" name="topic_pic"<?php if($_GET['topic_pic'] == '2'){ ?> checked="true"<?php } ?>> 没有</label>
					<label style="margin-left:10px; float:left;"><input type="radio" value="0" name="topic_pic"<?php if(!$_GET['topic_pic']){ ?> checked="true"<?php } ?>> 不限制</label>
				</p>
				<p style="clear:both;">
					<label> 是否有描述内容：</label>
					<label style="float:left;"><input type="radio" value="1" name="topic_description"<?php if($_GET['topic_description'] == '1'){ ?> checked="true"<?php } ?>> 有</label>
					<label style="margin-left:10px; float:left;"><input type="radio" value="2" name="topic_description"<?php if($_GET['topic_description'] == '2'){ ?> checked="true"<?php } ?>> 没有</label>
					<label style="margin-left:10px; float:left;"><input type="radio" value="0" name="topic_description"<?php if(!$_GET['topic_description']){ ?> checked="true"<?php } ?>> 不限制</label>
				</p>
				<p style="clear:both;">
					<input type="button" onclick="ajax_post($('#search_form'), _form_process);" value="搜  索" class="button">
				</p>
				</form>
			</div>
			
			
		</div>
		
		
		<div class="clear"></div>
		<div id="notf_tip" style="display:none;" class="notification png_bg"> <a href="javascript:;" class="close"><img src="<?php echo G_STATIC_URL;?>/admin/images/icons/cross_grey_small.png" alt="关闭" /></a>
			<div id="notf_cont"></div>
		</div>
		
	</div>
	
<!-- footer -->
<?php TPL::output('admin/global/footer.tpl.htm'); ?>
<!-- footer -->

</div>
<!-- main -->

</div>

</body>
</html>